package com.zfei.gfb.request;

import cn.hutool.core.lang.Validator;
import com.zfei.gfb.bean.Const;
import com.zfei.gfb.util.ObjUtil;
import com.zfei.gfb.bean.Status;
import com.zfei.gfb.bean.StatusException;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;


/**
 * @author fgh
 */
public class GfbCompanyEditRequest {

    // id
    @ApiModelProperty(value = "企业用户id", required = true)
    private Integer id;
    // 企业名称
    @ApiModelProperty(value = "企业名称", required = true)
    private String name;
    // 营业执照图片
    @ApiModelProperty(value = "营业执照图片", required = true)
    private String picUrl;
    // 法人
    @ApiModelProperty(value = "法人", required = true)
    private String corp;
    // 企业地址
    @ApiModelProperty(value = "企业地址", required = true)
    private String address;
    // 信用代码
    @ApiModelProperty(value = "信用代码", required = true)
    private String creditCode;
    // 联系人姓名
    @ApiModelProperty(value = "联系人姓名", required = true)
    private String linkmanName;
    // 联系人身份证号
    @ApiModelProperty(value = "联系人身份证号", required = true)
    private String linkmanIdCard;

    public void setId(Integer value) {
        this.id = value;
    }

    public Integer getId() {
        return this.id;
    }

    public void setName(String value) {
        this.name = value;
    }

    public String getName() {
        return this.name;
    }

    public void setPicUrl(String value) {
        this.picUrl = value;
    }

    public String getPicUrl() {
        return this.picUrl;
    }

    public void setCorp(String value) {
        this.corp = value;
    }

    public String getCorp() {
        return this.corp;
    }

    public void setAddress(String value) {
        this.address = value;
    }

    public String getAddress() {
        return this.address;
    }

    public void setCreditCode(String value) {
        this.creditCode = value;
    }

    public String getCreditCode() {
        return this.creditCode;
    }

    public void setLinkmanName(String value) {
        this.linkmanName = value;
    }

    public String getLinkmanName() {
        return this.linkmanName;
    }

    public void setLinkmanIdCard(String value) {
        this.linkmanIdCard = value;
    }

    public String getLinkmanIdCard() {
        return this.linkmanIdCard;
    }

    public void checkUpdateNull() {
        if (ObjUtil.anyNull(id, name, picUrl, corp, address, creditCode, linkmanName, linkmanIdCard)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        if (StringUtils.isAnyBlank(name, corp, address, creditCode, linkmanName, linkmanIdCard)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        if (!Validator.isUrl(picUrl)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        if (!Validator.isCitizenId(linkmanIdCard)) {
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
    }
}

